"""
# -*- coding: utf-8 -*-
# @Time    : 2023/6/17 10:45
# @Author  : 王摇摆
# @FileName: VGGNet.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
import matplotlib.pyplot as plt

epochs = range(1, 21)  # 横坐标，表示Epoch的取值范围

train_loss = [0.6700, 0.5839, 0.5446, 0.5247, 0.5118, 0.5041, 0.4976, 0.4897, 0.4858, 0.4860, 0.4784, 0.4793, 0.4733, 0.4726, 0.4679, 0.4694, 0.4689, 0.4705, 0.4664, 0.4636]
train_acc = [57.9300, 69.8000, 73.0550, 74.3250, 75.3650, 75.5600, 75.9650, 76.4350, 76.5650, 76.9250, 77.1550, 76.9850, 77.4750, 77.1950, 77.7200, 77.5900, 77.8850, 77.5900, 77.7700, 78.2250]
valid_loss = [0.6073, 0.5438, 0.5306, 0.4993, 0.4875, 0.4822, 0.4887, 0.4738, 0.4650, 0.4713, 0.4719, 0.4552, 0.4580, 0.4660, 0.4604, 0.4577, 0.4512, 0.4524, 0.4561, 0.4584]
valid_acc = [67.1800, 73.7000, 73.9200, 76.7000, 76.6800, 77.7400, 77.0800, 77.7800, 77.8000, 78.3000, 77.8600, 78.6600, 78.7800, 78.0600, 78.3000, 78.5600, 79.3200, 79.2600, 78.8600, 78.6800]

plt.figure(figsize=(10, 5))
plt.subplot(1, 2, 1)  # 绘制损失曲线
plt.plot(epochs, train_loss, 'bo-', label='Training Loss')
plt.plot(epochs, valid_loss, 'ro-', label='Validation Loss')
plt.title('Training and Validation Loss')
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.xticks(range(2, 21, 2))
plt.legend()

plt.subplot(1, 2, 2)  # 绘制准确率曲线
plt.plot(epochs, train_acc, 'bo-', label='Training Accuracy')
plt.plot(epochs, valid_acc, 'ro-', label='Validation Accuracy')
plt.title('Training and Validation Accuracy')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.xticks(range(2, 21, 2))
plt.legend()

plt.tight_layout()
plt.show()
